import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    component: () => import('../views/Layout/index.vue'),
    name: 'layout',
    children: [
      {
        path: '/',
        component: () => import('../views/Details/index.vue'),
        name: 'detail'
      },
      {
        path: '/home',
        component: () => import('../views/Home/index.vue'),
        name: 'home'
      },
      {
        path: 'category',
        component: () => import('../views/Category/index.vue'),
        name: 'category'
      },
      {
        path: 'cart',
        component: () => import('../views/Cart/index.vue'),
        name: 'cart'
      }
    ]
  },
  {
    path: '/admin',
    name: 'admin',
    component: () => import('../views/Admin/index.vue')
  },
  {
    path: '/login',
    component: () => import('../views/Login/index.vue'),
    name: 'login'
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
